<?php
$classname = "Task";
$path = "tasks/{$classname}.php";

if (!file_exists($path)) {
    throw new Exception("No such file as {$path}");
}
require_once($path);
$qclassname = "tasks\\$classname";
$myObject = new $qclassname();
$myObject->doSpeak();
?>